<div class="container">
  <h1>login_check()</h1>
  <p class="signature">public function login_check(string $submitted_username): string|bool</p>
  <h2>Description</h2>
  <div class="description">
    <p>
      Validates the submitted username and password for login authentication against existing usernames and hashed passwords stored in the 'trongate_administrators' table.
    </p>
    <p>
      This method is designed to be invoked as a form validation callback.
    </p>
  </div>

  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
        <th>Default</th>
        <th>Required</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>$submitted_username</td>
        <td>string</td>
        <td>The username submitted for login authentication.</td>
        <td>N/A</td>
        <td>Required</td>
      </tr>
    </tbody>
  </table>

  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>string|bool</td>
        <td>Returns TRUE (bool) if authentication is successful, otherwise returns an error message (string).</td>
      </tr>
    </tbody>
  </table>

  <h2>Example Usage</h2>
  <div class="example">
    <pre>if ($submit == 'Login') {
    $submitted_username = post('username');
    // Validate username and password for login.
    $this->validation->set_rules('username', 'username', 'required|callback_login_check');
    $this->validation->set_rules('password', 'password', 'required|min_length[5]');
    $result = $this->validation->run();

    if ($result === true) {
        $this->log_user_in($submitted_username);
    } else {
        // Reload login form on validation failure.
        $this->login();
    }
}</pre>
  </div>
</div>